home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / System / XADmaster / xad_dev / Sources / tools / xadLibInfo.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-01  |  4.3 KB  |  157 lines

  1. #define NAME         "xadLibInfo"
  2. #define DISTRIBUTION "(Freeware) "
  3. #define REVISION     "4"
  4. #define DATE         "16.03.2000"
  5.  
  6. /* Programmheader
  7.  
  8.     Name:        xadLibInfo
  9.     Author:        SDI
  10.     Distribution:    Freeware
  11.     Description:    show informations about xad Clients
  12.     Compileropts:    -
  13.     Linkeropts:    -gsi -l amiga
  14.  
  15.  1.0   18.11.98 : first version
  16.  1.1   30.06.99 : added XADCF_FREE flags
  17.  1.2   29.08.99 : added new SKIPINFO free flag
  18.  1.3   03.02.00 : added XADACF_FILESYSTEM flag
  19.  1.4   16.03.00 : added XADACF_NOCHECKSIZE flag
  20. */
  21.  
  22. #include <proto/xadmaster.h>
  23. #include <proto/exec.h>
  24. #include <proto/dos.h>
  25. #include <dos/dosasl.h>
  26. #include "SDI_version.h"
  27.  
  28. #ifdef __SASC
  29.   #define dosbase     DOSBase 
  30.   #define xadmasterbase     xadMasterBase 
  31.   #define ASSIGN_DOS
  32.   #define ASSIGN_XAD
  33.   #define ASSIGN_SYS     struct ExecBase * SysBase; \
  34.              SysBase = (*((struct ExecBase **) 4));
  35. #else
  36.   struct DosLibrary *     DOSBase = 0;
  37.   struct ExecBase *     SysBase  = 0;
  38.   struct xadMasterBase * xadMasterBase = 0;
  39.  
  40.   #define ASSIGN_DOS     DOSBase = dosbase;
  41.   #define ASSIGN_XAD     xadMasterBase = xadmasterbase;
  42.   #define ASSIGN_SYS     SysBase = (*((struct ExecBase **) 4));
  43. #endif
  44.  
  45. ULONG start(void)
  46. {
  47.   ULONG ret = RETURN_FAIL;
  48.   struct DosLibrary *dosbase;
  49.  
  50.   ASSIGN_SYS
  51.   { /* test for WB and reply startup-message */
  52.     struct Process *task;
  53.     if(!(task = (struct Process *) FindTask(0))->pr_CLI)
  54.     {
  55.       WaitPort(&task->pr_MsgPort);
  56.       Forbid();
  57.       ReplyMsg(GetMsg(&task->pr_MsgPort));
  58.       return RETURN_FAIL;
  59.     }
  60.   }
  61.  
  62.   if((dosbase = (struct DosLibrary *) OpenLibrary("dos.library", 37)))
  63.   {
  64.     struct xadMasterBase *xadmasterbase;
  65.     ASSIGN_DOS
  66.     if((xadmasterbase = (struct xadMasterBase *) 
  67.     OpenLibrary("xadmaster.library", 1)))
  68.     {
  69.       ULONG fl;
  70.       struct xadClient *xc;
  71.  
  72.       ASSIGN_XAD
  73.       ret = 0;
  74.       if((xc = xadGetClientInfo()))
  75.         Printf("\033[4mClients of xadmaster.library %ld.%ld\033[0m\n\n"
  76.     "Name                      |  ID  | MV |  VER  | Flags\n"
  77.     "--------------------------+------+----+-------+------------------------------\n",
  78.     xadmasterbase->xmb_LibNode.lib_Version,
  79.     xadmasterbase->xmb_LibNode.lib_Revision);
  80.       
  81.       while(xc && !(SetSignal(0L,0L) & SIGBREAKF_CTRL_C))
  82.       {
  83.         fl = xc->xc_Flags;
  84.  
  85.         Printf("%-26s| ", xc->xc_ArchiverName);
  86.         Printf(xc->xc_Identifier ? "%04ld" : "----", xc->xc_Identifier);
  87.         Printf(" | %2ld |%3ld.%ld%s| ", xc->xc_MasterVersion,
  88.         xc->xc_ClientVersion, xc->xc_ClientRevision, xc->xc_ClientRevision
  89.         >= 100 ? "" : xc->xc_ClientRevision >= 10 ? " " : "  ");
  90.         if(fl & XADCF_FILEARCHIVER)
  91.         {
  92.           fl &= ~XADCF_FILEARCHIVER;
  93.           Printf("FILE%s", fl ? "," : "");
  94.         }
  95.         if(fl & XADCF_DISKARCHIVER)
  96.         {
  97.           fl &= ~XADCF_DISKARCHIVER;
  98.           Printf("DISK%s", fl ? "," : "");
  99.         }
  100.         if(fl & XADCF_FILESYSTEM)
  101.         {
  102.           fl &= ~XADCF_FILESYSTEM;
  103.           Printf("FILESYS%s", fl ? "," : "");
  104.         }
  105.         if(fl & XADCF_EXTERN)
  106.         {
  107.           fl &= ~XADCF_EXTERN;
  108.           Printf("EXTERN%s", fl ? "," : "");
  109.         }
  110.         if(fl & XADCF_NOCHECKSIZE)
  111.         {
  112.           fl &= ~XADCF_NOCHECKSIZE;
  113.           Printf("NOCHECKSIZE%s", fl ? "," : "");
  114.         }
  115.         fl &= XADCF_FREEFILEINFO|XADCF_FREEDISKINFO|XADCF_FREETEXTINFO|XADCF_FREESKIPINFO|XADCF_FREETEXTINFOTEXT;
  116.         if(fl)
  117.         {
  118.           Printf("FREE(");
  119.           if(fl & XADCF_FREEFILEINFO)
  120.           {
  121.             fl &= ~XADCF_FREEFILEINFO;
  122.             Printf("FI%s", fl ? "," : ")");
  123.           }
  124.           if(fl & XADCF_FREEDISKINFO)
  125.           {
  126.             fl &= ~XADCF_FREEDISKINFO;
  127.             Printf("DI%s", fl ? "," : ")");
  128.           }
  129.           if(fl & XADCF_FREETEXTINFO)
  130.           {
  131.             fl &= ~XADCF_FREETEXTINFO;
  132.             Printf("TI%s", fl ? "," : ")");
  133.           }
  134.           if(fl & XADCF_FREESKIPINFO)
  135.           {
  136.             fl &= ~XADCF_FREESKIPINFO;
  137.             Printf("SI%s", fl ? "," : ")");
  138.           }
  139.           if(fl & XADCF_FREETEXTINFOTEXT)
  140.             Printf("TEXT)");
  141.         }
  142.  
  143.         Printf("\n");
  144.     xc = xc->xc_Next;
  145.       }
  146.       if(SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
  147.         PrintFault(ERROR_BREAK,0 );
  148.  
  149.       CloseLibrary((struct Library *) xadmasterbase);
  150.     }
  151.     else
  152.       Printf("Could not open xadmaster.library\n");
  153.     CloseLibrary((struct Library *) dosbase);
  154.   }
  155.   return ret;
  156. }
  157.